package com;

import com.yYclass.AccountApplication;
import com.yYclass.component.SmsComponent;
import com.yYclass.config.SmsConfig;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = AccountApplication.class)
@Slf4j
public class SendMsg {

    @Autowired
    private SmsComponent smsComponent;

    @Autowired
    private SmsConfig smsConfig;

    @Test
    public  void testSendSms(){
//        String appCode = smsConfig.getAppCode();
//        System.out.println(appCode);
        smsComponent.send("17600365830","","【宥宥课堂】您的验证码如下，请勿泄露：233666。");
    }

    @Test
    public  void getTemplateList(){
        smsComponent.getTemplateList();
    }

    @Test
    public  void createTemplate(){
        smsComponent.createTemplate("");
    }

    @Test
    public  void getDemo(){
        LocalTime now = LocalTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        String timeString = now.format(formatter);
        System.out.println("当前时间是: " + timeString);
    }
}
